<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // 每隔一段时间执行一次
      const s1 = setInterval(() => {
        console.log("hello");
      }, 1000);

      setTimeout(() => {
        clearInterval(s1);
      }, 4000);
    </script>
  </body>
</html>
